class Watcher {
  constructor(vm, key, fn) {
    this.vm = vm;
    this.key = key;
    this.fn = fn;
    
    Dep.target = this;
    console.log(Dep.target)
    console.log(this.vm[this.key])
    console.log(key)
    this.vm[this.key]
    Dep.target = null;

  }

  update() {
    // this.vm
    this.fn(this.vm[this.key])
  }
}

class Dep {
  constructor() {
    this.deps = []
  }

  addDep(t) {
    this.deps.push(t)
  }
  
  update() {
    this.deps.forEach(k=> {
      k.update();
    })

  }
}